package com.cqywc.cjadmin.pojo;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Range;

import com.cqywc.cjadmin.validate.MenuAdd;
import com.cqywc.cjadmin.validate.MenuEdit;

public class Menu {
	@NotNull(groups= {MenuEdit.class})
    private Integer id;
	
	@NotNull(groups= {MenuAdd.class,MenuEdit.class})
	@Min(value=0,groups= {MenuAdd.class,MenuEdit.class})
    private Integer pid;
	
	@NotBlank(groups= {MenuAdd.class,MenuEdit.class})
	@Size(min=2,max=50,groups= {MenuAdd.class,MenuEdit.class})
    private String module;
	
	@NotNull(groups= {MenuAdd.class,MenuEdit.class})
	@Range(min=1,max=2,groups= {MenuAdd.class,MenuEdit.class})
    private Byte type;
	
    @Size(min=2,max=50,message="路径长度2-5",groups= {MenuAdd.class,MenuEdit.class})
    private String path;
    
    @Size(min=2,max=50,message="标题长度2-5",groups= {MenuAdd.class,MenuEdit.class})
    private String title;
    
    private Byte status;
    
    @NotBlank(groups= {MenuAdd.class,MenuEdit.class})
    @Size(min=2,max=50,groups= {MenuAdd.class,MenuEdit.class})
    private String icon;

    private String font;
    
    @NotNull(groups= {MenuAdd.class,MenuEdit.class})
    private Integer sort;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public String getModule() {
        return module;
    }

    public void setModule(String module) {
        this.module = module == null ? null : module.trim();
    }

    public Byte getType() {
        return type;
    }

    public void setType(Byte type) {
        this.type = type;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path == null ? null : path.trim();
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title == null ? null : title.trim();
    }

    public Byte getStatus() {
        return status;
    }

    public void setStatus(Byte status) {
        this.status = status;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon == null ? null : icon.trim();
    }

    public String getFont() {
        return font;
    }

    public void setFont(String font) {
        this.font = font == null ? null : font.trim();
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

	@Override
	public String toString() {
		return "Menu [id=" + id + ", pid=" + pid + ", module=" + module + ", type=" + type + ", path=" + path
				+ ", title=" + title + ", status=" + status + ", icon=" + icon + ", font=" + font + ", sort=" + sort
				+ "]";
	}
    
}